var e = require("../../../@babel/runtime/helpers/regeneratorRuntime"),
  t = require("../../../@babel/runtime/helpers/slicedToArray"),
  o = require("../../../@babel/runtime/helpers/asyncToGenerator"),
  r = require("../../../store/index"),
  n = require("../../../utils/helper/common/index");
Component({
  useStore: function (e) {
    return {
      customerServicePhone: e.global.customerServicePhone,
      customerServiceVx: e.global.customerServiceVx
    }
  },
  externalClasses: ["group-class"],
  properties: {
    isShowLink: {
      type: Boolean,
      value: !0
    }
  },
  data: {
    showPopup: !1,
    vx: ""
  },
  methods: {
    onTap: function () {
      var e = this.data.showPopup;
      this.setData({
        showPopup: !e
      })
    },
    onCopy: function () {
      var e = this.data.vx;
      wx.setClipboardData({
        data: e,
        success: function () {
          wx.hideToast(), wx.showModal({
            title: "温馨提示",
            content: "微信号:".concat(e, "已复制到粘贴板,去微信-添加朋友-搜索框粘贴!"),
            showCancel: !1
          })
        }
      })
    },
    onCall: function () {
      var e = this.data.customerServicePhone;
      (0, n.callPhone)(e)
    },
    getVx: function () {
      return o(e().mark((function o() {
        var n, a, s;
        return e().wrap((function (e) {
          for (;;) switch (e.prev = e.next) {
            case 0:
              return e.next = 2, $.request["POST/us/wx-account?source=XCX"]({
                "content-type": "application/json"
              });
            case 2:
              n = e.sent, a = t(n, 1), 200 === (s = a[0]).code && (0, r.dispatch)(r.actions.globalActions.setState({
                customerServiceVx: s.content
              }));
            case 6:
            case "end":
              return e.stop()
          }
        }), o)
      })))()
    }
  },
  lifetimes: {
    attached: function () {
      this.getVx()
    }
  }
});